package com.cvtt.voice;

import android.content.Context;

import com.cvtt.sip.SIPConfig;

public class VoiceConfig {
	
	public static boolean LOG_ENABLE = false;
		
	public static final String CONFIG_NODATA = "nodata";
	public static final String CONFIG_RINGTONE = "ringtone";
	public static final String CONFIG_EARGAIN = "eargain";
	public static final String CONFIG_MICGAIN = "micgain";
	public static final String CONFIG_HEARGAIN = "heargain";
	public static final String CONFIG_HMICGAIN = "hmicgain";
	
	public static final String CONFIG_BLUETOOTH = "bluetooth";
	
	public static final String CONFIG_IMPROVE = "improve";
	
	public static final String CONFIG_SELECTWIFI = "selectwifi";
	
	public static final boolean DEFAULT_BLUETOOTH = false;
	
	public static final boolean DEFAULT_IMPROVE = false;
	
	public static final boolean DEFAULT_SELECTWIFI = false;
	
	public static final boolean DEFAULT_NODATA = false;
	public static final String DEFAULT_SIPRINGTONE = "";

	public static final float DEFAULT_EARGAIN = (float) 1.0;
	public static final float DEFAULT_MICGAIN = (float) 1.0;
	public static final float DEFAULT_HEARGAIN = (float) 1.0;

	public static final float DEFAULT_HMICGAIN = (float) 1.0;
	
	public static int docked = -1, headset = -1, bluetooth = -1;
	
	private Context context;

	private static VoiceConfig voiceConfig = null;

	public static VoiceConfig getInstance(Context ctx) {
		if (voiceConfig == null) {
			voiceConfig = new VoiceConfig(ctx);
		}
		return voiceConfig;
	}
	
	public static VoiceConfig getVoiceConfig() {
		return voiceConfig;
	}

	private VoiceConfig(Context ctx) {
		context = ctx;
	}
	
	public void setContext(Context ctx)
	{
		context = ctx;
	}
	
	public Context getContext()
	{
		return context;
	}
	
	public static float getEarGain() {
		/*try {
			return  DEFAULT_EARGAIN;
		}
		catch (NumberFormatException i) {
			return DEFAULT_EARGAIN;
		}*/
		return DEFAULT_EARGAIN;
	}

	public static float getMicGain() {
		// TODO:
		/*if (SIPConfig.headset > 0 || SIPConfig.bluetooth > 0) {
			return Float.valueOf(PreferencesUtil.getString(CONFIG_HMICGAIN, "" + DEFAULT_HMICGAIN));
		}

		return Float.valueOf(PreferencesUtil.getString(CONFIG_MICGAIN, "" + DEFAULT_MICGAIN));*/
		return DEFAULT_MICGAIN;
	}

}
